using IcsSEMCtrl.Util;
using System;
namespace IcsSEMCtrl.Global.Exception
{
	public class ECPExceptionType
	{
		public const int _NOT_FOUND = 0;
		public const int _NOT_SUPPORTED = 1;
		public const int _DUPLICATE = 2;
		public const int _INVALID_VALUE = 3;
		public const int _OPERATION_ABORTED = 4;
		private int _value;
		private static int _size;
		private static ECPExceptionType[] _array;
		public static string[] displayStrings;
		public static ECPExceptionType[] dispalyValues;
		public static ECPExceptionType NOT_FOUND;
		public static ECPExceptionType NOT_SUPPORTED;
		public static ECPExceptionType DUPLICATE;
		public static ECPExceptionType INVALID_VALUE;
		public static ECPExceptionType OPERATION_ABORTED;
		public static ECPExceptionType IT_ENUM_MAX;
		static ECPExceptionType()
		{
			ECPExceptionType._size = 5;
			ECPExceptionType._array = new ECPExceptionType[ECPExceptionType._size];
			ECPExceptionType.displayStrings = new string[ECPExceptionType._size];
			ECPExceptionType.dispalyValues = new ECPExceptionType[ECPExceptionType._size];
			ECPExceptionType.NOT_FOUND = new ECPExceptionType(0);
			ECPExceptionType.NOT_SUPPORTED = new ECPExceptionType(1);
			ECPExceptionType.DUPLICATE = new ECPExceptionType(2);
			ECPExceptionType.INVALID_VALUE = new ECPExceptionType(3);
			ECPExceptionType.OPERATION_ABORTED = new ECPExceptionType(4);
			ECPExceptionType.IT_ENUM_MAX = new ECPExceptionType(2147483647);
			ECPExceptionType.displayStrings[0] = "Not Found";
			ECPExceptionType.displayStrings[1] = "Not Supported";
			ECPExceptionType.displayStrings[2] = "Duplicate";
			ECPExceptionType.displayStrings[3] = "Invalid Value";
			ECPExceptionType.displayStrings[4] = "Operation Aborted";
			ECPExceptionType.dispalyValues[0] = ECPExceptionType.NOT_FOUND;
			ECPExceptionType.dispalyValues[1] = ECPExceptionType.NOT_SUPPORTED;
			ECPExceptionType.dispalyValues[2] = ECPExceptionType.DUPLICATE;
			ECPExceptionType.dispalyValues[3] = ECPExceptionType.INVALID_VALUE;
			ECPExceptionType.dispalyValues[4] = ECPExceptionType.OPERATION_ABORTED;
		}
		public static string ValueToString(ECPExceptionType val)
		{
			string result;
			switch (val.Value())
			{
			case 0:
				result = ECPExceptionType.displayStrings[0];
				break;
			case 1:
				result = ECPExceptionType.displayStrings[1];
				break;
			case 2:
				result = ECPExceptionType.displayStrings[2];
				break;
			case 3:
				result = ECPExceptionType.displayStrings[3];
				break;
			case 4:
				result = ECPExceptionType.displayStrings[4];
				break;
			default:
				result = "";
				break;
			}
			return result;
		}
		public static ECPExceptionType StringToValue(string val)
		{
			ECPExceptionType result;
			if (Helper.IsNullOrEmpty(val))
			{
				result = ECPExceptionType.IT_ENUM_MAX;
			}
			else
			{
				for (int i = 0; i < ECPExceptionType.displayStrings.Length; i++)
				{
					if (val.Equals(ECPExceptionType.displayStrings[i]))
					{
						result = ECPExceptionType.dispalyValues[i];
						return result;
					}
				}
				result = null;
			}
			return result;
		}
		public int Value()
		{
			return this._value;
		}
		public static ECPExceptionType From_Int(int value)
		{
			ECPExceptionType result;
			if (value >= 0 && value < ECPExceptionType._size)
			{
				result = ECPExceptionType._array[value];
			}
			else
			{
				result = ECPExceptionType.IT_ENUM_MAX;
			}
			return result;
		}
		protected ECPExceptionType(int value)
		{
			this._value = value;
			if (value >= 0 && value < ECPExceptionType._size)
			{
				ECPExceptionType._array[this._value] = this;
			}
		}
		public bool Equals(ECPExceptionType otherEnum)
		{
			return otherEnum.Value() == this._value;
		}
		public override string ToString()
		{
			return ECPExceptionType.displayStrings[this._value];
		}
	}
}
